package hari2.latihan;

import java.util.HashMap;
import java.util.Map;

public class PhoneBook {
	public static void main(String[] args) {
		Map myPhoneBook = new HashMap();
		System.out.println(myPhoneBook.size());
		
		myPhoneBook.put("Balicamp Training", "5678910");
		myPhoneBook.put("Joe Blogg", "888-999");
		myPhoneBook.put("Balicamp Training", "5471969");
		
		if (myPhoneBook.isEmpty()) {
			System.out.println("phonebook is empty");
		} else {
			System.out.println("phonebook contains: " + myPhoneBook.size());
		}
		
		String nameToSearch = "Balicamp Training";
		if (myPhoneBook.containsKey(nameToSearch)) {
			String phoneFound = (String) myPhoneBook.get(nameToSearch);
			System.out.println(nameToSearch + " : " + phoneFound);
		}
	}
}
